#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

float mul(float x, float y);
float ddiv(float x, float y);
int main()
{
	float* x=(float*)malloc(sizeof(float));
	float* y=(float*)malloc(sizeof(float));
	printf("Please enter multiplicand/dividend: ");
	scanf("%f",x);
	printf("Please enter multiplier/divisor: ");
	fflush(stdin);
	scanf("%f",y);
	printf("The mul result is %f\n",mul(*x,*y));
	printf("The div result is %f\n",ddiv(*x,*y));
    return 0;
}

float mul(float x, float y)
{
	float res = 0.0;
	int Ex, Ey;
	double Mx = frexp(x,&Ex);
	double My = frexp(y,&Ey);
	res = ldexp(Mx*My, Ex+Ey);
	return res;
}
float ddiv(float x, float y)
{
	float res = 0.0;
	int Ex, Ey;
	double Mx = frexp(x,&Ex);
	double My = frexp(y,&Ey);
	res = ldexp(Mx/My, Ex-Ey);
	return res;
}
